<?php

/**
 * EncPersona form base class.
 *
 * @method EncPersona getObject() Returns the current form's model object
 *
 * @package    encuestas
 * @subpackage form
 * @author     qualem
 */
abstract class BaseEncPersonaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'nombre'           => new sfWidgetFormInputText(),
      'apellido_paterno' => new sfWidgetFormInputText(),
      'apellido_materno' => new sfWidgetFormInputText(),
      'telefono'         => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'password'         => new sfWidgetFormInputText(),
      'grupo_id'         => new sfWidgetFormPropelChoice(array('model' => 'EncGrupo', 'add_empty' => true)),
      'encuesta_id'      => new sfWidgetFormPropelChoice(array('model' => 'EncEncuesta', 'add_empty' => true)),
      'evaluacion_id'    => new sfWidgetFormPropelChoice(array('model' => 'EncEvaluacion', 'add_empty' => true)),
      'evaluacion_grupo' => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'is_actived'       => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'nombre'           => new sfValidatorString(array('max_length' => 30)),
      'apellido_paterno' => new sfValidatorString(array('max_length' => 30)),
      'apellido_materno' => new sfValidatorString(array('max_length' => 30)),
      'telefono'         => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'email'            => new sfValidatorString(array('max_length' => 255)),
      'password'         => new sfValidatorString(array('max_length' => 255)),
      'grupo_id'         => new sfValidatorPropelChoice(array('model' => 'EncGrupo', 'column' => 'id', 'required' => false)),
      'encuesta_id'      => new sfValidatorPropelChoice(array('model' => 'EncEncuesta', 'column' => 'id', 'required' => false)),
      'evaluacion_id'    => new sfValidatorPropelChoice(array('model' => 'EncEvaluacion', 'column' => 'id', 'required' => false)),
      'evaluacion_grupo' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(array('required' => false)),
      'updated_at'       => new sfValidatorDateTime(array('required' => false)),
      'is_actived'       => new sfValidatorBoolean(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'EncPersona', 'column' => array('email')))
    );

    $this->widgetSchema->setNameFormat('enc_persona[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'EncPersona';
  }


}
